﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.ServiceModel.Description;
using NotificationServer.ServiceLayer.Contracts;
using NotificationServer.ServiceLayer.Services;

namespace NotificationServer
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                string baseUri = "http://localhost:6000/";
                // test
                using (ServiceHost host = new ServiceHost(typeof(Service)))
                {
                    host.Open();
                    Console.WriteLine("Service is up and running on Address: " + baseUri);
                    Console.WriteLine("Press enter to quit ");
                    Console.ReadLine();
                }
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(ex.Message);
            }



            Console.ReadLine();


            /*
             Now it is configured in Configuration file
             
             string baseUri = "http://localhost:5000/";
            WebServiceHost host = 
                new WebServiceHost(typeof(DeviceService), 
                new Uri(baseUri));
            ServiceEndpoint ep = host.AddServiceEndpoint(typeof(IDevice), new WebHttpBinding(), "");
            
            ServiceDebugBehavior stp = host.Description.Behaviors.Find<ServiceDebugBehavior>();
            stp.HttpHelpPageEnabled = false;
            host.Open();
            Console.WriteLine("Service is up and running on Address: " + baseUri );
            Console.WriteLine("Press enter to quit ");
            Console.ReadLine();
            host.Close();*/
        }
    }
}